extends Area3D
class_name EffectTargetCollector3D

## 发出该 [Ability] 的 [AbilitySystemComponent]
@export var source:AbilitySystemComponent

## 该 [EffectTargetCollector3D] 携带的 Effects
@export var effects:Array[Effect]


func _enter_tree() -> void:
	area_entered.connect(on_area_entered)
	body_entered.connect(on_body_entered)


func on_area_entered(area:Area3D):
	#prints("on area entered:",area,"ASC" in area)
	pass

func on_body_entered(body):
	prints("on body entered:",body,"ASC" in body)
	if "ASC" in body:
		if body.ASC and body.ASC != source:
			var asc = body.ASC as AbilitySystemComponent
			asc.apply_effects(effects)
			
